package com.fernfx.xingtan.common.network.entity;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import okhttp3.Headers;


public class NetworkErrorResult implements Serializable {
    private static final long serialVersionUID = 4879724958565722007L;

    private int mErrorCode;
    private String mErrorMessage;
    private Map<String, String> mHeaders;

    public NetworkErrorResult(String errorMessage, int errorCode, Headers headers) {
        mErrorCode = errorCode;
        mErrorMessage = errorMessage;

        if(null != headers) {
            mHeaders = new HashMap<>();
            for (String header : headers.names()) {
                mHeaders.put(header, headers.get(header));
            }
        }
    }

    public int getErrorCode() {
        return mErrorCode;
    }

    public String getErrorMessage() {
        return mErrorMessage;
    }

    public Map<String, String> getHeaders() {
        return mHeaders;
    }
}
